package com.example.myapplication;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.List;

public class myPlanAdapter extends ArrayAdapter<myPlan> {

    private int resourceId;
    public myPlanAdapter(Context context, int textViewResourceId, List<myPlan> objects)
    {
        super(context,textViewResourceId,objects);
        resourceId=textViewResourceId;

    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        myPlan plan=getItem(position);
        View view;
        if (convertView==null)
        {
            view= LayoutInflater.from(getContext()).inflate(resourceId,parent,false);
        }
        else
        {
            view=convertView;
        }

        TextView palnName=(TextView)view.findViewById(R.id.plan_name);

        palnName.setText(plan.getName());
        return view;
    }
}
